//杨辉三角形

import java.util.Scanner;

public class text29 {
    public static void main(String[] args) {
        int i = 0;
        int j = 0;
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入想要生成的行数->");
        int num = sc.nextInt();
        //二维数组
        int[][] arr = new int[num][num];
        //第一列都是1，第x行x列都是1
        for (i = 0; i < num; i++) {
            arr[i][0] = 1;
            arr[i][i] = 1;
        }
        //从第二行快开始第一列开始
        for (i = 2; i < num; i++) {
            for (j = 1; j < i; j++){
                arr[i][j] = arr[i-1][j-1] + arr[i-1][j];
            }
        }
        //输出
        for ( i = 0; i < num; i++) {
            for(j=0;j<=i;j++){
                System.out.print(arr[i][j]+"  ");
            }
            System.out.println();
        }
    }
}
